home *** CD-ROM | disk | FTP | other *** search
- /************************************************************
- *
- * Created: Sunday, December 7, 1992 8:56:00 PM
- * CNeoIterator.h
- * C++ class definition for index iterator objects
- *
- *
- * Copyright © Neologic Systems 1992-1994. All Rights Reserved.
- * All rights reserved
- *
- *
- * Within a class, references to permanent objects are kept
- * in a sorted list called an index. It is often necessary to
- * serial traverse a list of objects in an index. Iterators
- * make the process of traversing an index easier. They also
- * allow indices to be used as all other collection classes.
- *
- ***********************************************************/
- #pragma once /* Include this file only once */
- #ifndef __CNeoIterator__
- #define __CNeoIterator__ 1
-
- #include "NeoTypes.h"
-
- class CNeoPersist;
- class CNeoNode;
-
- class CNeoIterator {
- public:
- /** Instance Methods **/
- CNeoIterator(CNeoNode *aNode = nil, CNeoSelect *aKey = nil, const Boolean aForward = TRUE, const Boolean aReset = TRUE);
- virtual ~CNeoIterator(void);
-
- /** Access Methods **/
- short getIndex(void) const {return fIndex;}
- CNeoNode * getNode(void) const {return fNode;}
- Boolean isForward(void) const {return fForward;}
- void setForward(const Boolean aForward) {fForward = aForward;}
- void setNode(CNeoNode *aNode, const short aIndex);
-
- /** Object List Management Methods **/
- virtual Boolean cross(const Boolean aForward = TRUE);
- virtual CNeoPersist *
- currentObject(void);
- virtual void * doUntil(NeoTestFunc1 aFunc, void *aParam = nil);
- virtual Boolean leap(const long aDelta);
- virtual Boolean more(void);
- virtual CNeoPersist *
- nextObject(void);
- virtual CNeoPersist *
- previousObject(void);
- virtual CNeoNode * removeCurrent(void);
- virtual void reset(void);
-
- Boolean fForward; // In which direction do we progress?
- Boolean fLinear; // Are we doing a linear search over the index?
- Boolean fMatched; // Is the current object a match?
- Boolean fDone; // Have we reached the end of the list?
- short fIndex; // Current entry in the current node.
- CNeoNode * fNode; // The current node.
- CNeoSelect * fKey; // The key that determines which objects to include.
-
- CNeoIterator * fNextIter; // Forward reference to iterators looking at fNode
- CNeoIterator * fPrevIter; // Backward reference to iterators looking at fNode
-
- protected:
- virtual Boolean advance(const short aDelta);
- };
- #endif
-